import numpy as np

arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr)
print(type(arr))

print(arr[::, ::2])

print(arr.shape)

print(arr[::, ::-1])

print(arr[::-1, ::-1])

print(arr.reshape([3, 2]))  # 修改形状

print(arr[::, [1, 2]])

print(arr * 2)
print(arr / 2)
print(arr - 2)
print(arr % 2)
print(arr // 2)

print(arr > 2)

# 取出大于2的数据
print(arr[arr > 2])

print(arr.T)

arr1 = np.array([[1, 3, 5], [7, 9, 11]])
arr2 = np.array([[2, 4, 6], [8, 10, 12]])

print(arr1 - arr2)
print(arr1 + arr2)
print(arr1 * arr2)
print(arr1 / arr2)

print(np.sin(arr))
print(np.log2(arr))

print(np.diff(arr, axis=0))
print(np.diff(arr, axis=1))

print(np.max(arr, axis=0))
print(np.min(arr))
print(np.average(arr))

print(np.random.random([4, 5]))

arr1 = np.array([[1, 2, 3], [4, 5, 6]])

arr2 = np.array([[2, 2], [2, 2], [2, 2]])

print(arr1)
print(arr2)

#矩阵相乘
print(arr1.dot(arr2))
